# -*- encoding=utf8 -*-
"""
RedFlag-TC0000120  （拍摄进入装饰页）返回功能
未操作点击上一步场景
操作后点击上一步场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *

auto_setup(__file__)
shooter = CameraVideoShooter()

log("--------------------------------未操作点击上一步场景--------------------------------------")
"""
拍摄视频进入装饰页
点击返回
断言
"""

shooter.enter_photography_decoration_page()
shooter.click_element(decoration_page_return_button)
shooter.assert_element_exists(shooting_page_prop, "断言失败，预期元素并未出现")

log("--------------------------------操作后点击上一步场景--------------------------------------")
"""
点击✓
点击滤镜
新增一个滤镜
取消滤镜工具栏
点击上一步
二次确认弹窗点击取消
点击上一步
而且确认弹窗点击确定
断言
"""

shooter.click_element(shooting_page_next_button)
shooter.click_element(decoration_page_filter_function)
shooter.click_element(decoration_page_filter_original_aspiration)
touch((0.5, 0.5))
shooter.click_element(poco("cn.migu.video.clip.walle:id/clip_comm_title_left_btn"))
shooter.click_element(decoration_page_return_cancel)
shooter.click_element(poco("cn.migu.video.clip.walle:id/clip_comm_title_left_btn"))
shooter.click_element(decoration_page_return_confirm)
sleep(2.0)
shooter.assert_element_exists(shooting_page_delete_video, "断言失败，预期按钮并未出现")

# 关闭应用
stop_app(UGC_package_name)